<template>
  <view class="page-body">
   <u-navbar :is-back="false" title="促销添加"
     title-size="30"
     :background="{background:'#2B88FE' }"
     title-color="#fff">
     <div class="head_icon">
       <u-icon @click="$api.handleBackTo"
         name="arrow-left" color="#fff"
         size="36">
       </u-icon>
       <u-icon @click="$api.handleHomeTo"
         name="home" color="#fff" size="36">
       </u-icon>
     </div>
   </u-navbar>
    <view class="clist x-row">
      <view class="x-col-center cname">
        姓名
      </view>
        <input type="text" placeholder="请输入姓名" v-model="form.fName" />
    </view>
	
	<view class="clist x-row">
	  <view class="x-col-center cname">
	    电话
	  </view>
	   <input type="text" placeholder="请输入电话" v-model="form.fTell" />
	</view>
	
	<view class="clist x-row">
	  <view class="x-col-center cname">
	    微信
	  </view>
	    <input type="text" placeholder="请输入微信" v-model="form.fWX" />
	</view>
	
	<view class="clist x-row">
	  <view class="x-col-center cname">
	    促销产品
	  </view>
	   <input type="text" placeholder="请输入促销产品" v-model="form.fProducts" />
	</view>
	 
	<view class="clist x-row">
	  <view class="x-col-center cname">
	    对账数量
	  </view>
	  <input placeholder="请输入对账数量" v-model="form.fSalesCount " type="digit"
	    class="x-col x-col-center "></input>
	  <view class="rmb x-col-center">
	    
	  </view>
	</view>
	
	<view class="clist x-row">
	  <view class="x-col-center cname">
	    超市打款
	  </view>
	  <input placeholder="请输入超市打款" v-model="form.fMrkPayMoney " type="digit"
	    class="x-col x-col-center "></input>
	  <view class="rmb x-col-center">
	    元
	  </view>
	</view>
	
	<view class="clist x-row">
	  <view class="x-col-center cname">
	    收款微信
	  </view>
	  <input placeholder="请输入收款微信" v-model="form.fWxPayMoney " type="digit"
	    class="x-col x-col-center "></input>
	  <view class="rmb x-col-center">
	    元
	  </view>
	</view>
	
	<view class="clist x-row">
	  <view class="x-col-center cname">
	    领取金额
	  </view>
	  <input placeholder="请输入领取金额" v-model="form.fMoneyPay" type="digit"
	    class="x-col x-col-center "></input>
	  <view class="rmb x-col-center">
	    元
	  </view>
	</view>
	<view class="clist x-row">
	  <view class="x-col-center cname">
	    支付方式
	  </view>
	   <input type="text" placeholder="请输入支付方式" v-model="form.fPayType" />
	</view>
	
	<view class="clist x-row">
	  <view class="x-col-center cname">
	    对接业务
	  </view>
	   <input type="text" placeholder="请输入对接业务" v-model="form.fContactUser" />
	</view>
	<view class="clist x-row">
	  <view class="x-col-center cname">
	    领取时间
	  </view>
	   
	   <input type="text" placeholder="请选择" v-model="form.PayTime"
	     class="x-col-center x-col inputs" disabled @click="start_cl" />
	   <u-icon name="arrow-right" color="#979797" size="26">
	   </u-icon>
	   <u-picker mode="time" @confirm="start_timeComfirm" v-model="start" :params="params">
	   </u-picker>
	   
	   
	</view>
	
    <view class="h16">

    </view>
    <view class="infos whiteBg">
      <view class="clist x-row ">
        <view class="x-col-center cname" style="width: 300rpx;">
          基础资料
        </view>
      </view>
      <textarea v-model="form.fInfo" class="txt" placeholder="请在此输基础资料…"></textarea>

     <view class="clist x-row ">
        <view class="x-col-center cname" style="width: 300rpx;">
          其他信息
        </view>
      </view>
      <textarea v-model="form.fOther" class="txt" placeholder="请在此输其他信息…"></textarea>

      <view class="clist x-row">
        <view class="x-col-center cname">
          图片
        </view>
      </view>
      <u-upload ref="uUpload" :header="header" max-count="8" name="file" :action="action"
        :auto-upload="true">
      </u-upload>
    </view>
    <view :style="{height:height}"></view>
    <view class="viewbbutton" :style="{height:height}">
      <button class="sendBomBtn" @click="submit">提 交</button>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      form: {
	    fMrkId: this.id,
	    fName: '',
		fWX: '',
	    fTell: '',
	    fPic: '',
	    fInfo: '',
		
	    fProducts: '',
		fSalesCount: 0,
	    fMrkPayMoney: 0,
	    fWxPayMoney: 0,
	    fMoneyPay: 0,
		PayTime: '',
		fPayType: '',	
		fContactUser: '',	
		fOther: ''
      },
	  params: {
	    year: true,
	    month: true,
	    day: true,
	    hour: true,
	    minute: true,
	    second: false
	  },
	  start: false, //开始时间
	  clineOnce:true,
	 id: 0,
      header: {
        token: uni.getStorageSync('token')
      },
      height: this.but_height(),
      action: this.urlimg + 'api/Upfile/PostImgFile',
      clist: [],
      isAllList: 1,
      page: 1,
      status: 'loading',
      loading: true
    }
  },
  onLoad(e) {
    uni.setNavigationBarTitle({
      title: '新增账单'
    })
	 this.id = Number(e.id)
  },
  methods: {
    // user/submit_apply 			新增报销
    submit() {
		if (!this.clineOnce) return false
		this.clineOnce = false
		 this.form.fMrkId=this.id
      this.form.fPic = this.$api.getreqImg(this.$refs.uUpload.lists)
      this.$axios('api/SaleBasic/AddDetail', 'post', { value: this.form }).then(res => {
		  if (!res.Success) {
		    uni.showToast({
		      title: '提交失败：'+res.Message,
		      icon: 'none',
		      duration: 2000
		    })
		   this.clineOnce = true
		    return false
		  }
		 this.clineOnce = true
        this.$api.handleToUrl('提交成功', '/pages/my_customer/SaleList?id='+this.id)
      })
    },
	start_timeComfirm(e) {
	  this.form.PayTime = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute
	},
	start_cl() {
	  this.start = true
	}
  }
}
</script>

<style lang="scss">
.clist {
  padding: 34rpx 32rpx;
  box-sizing: border-box;
  background-color: #ffffff;
  .cname {
    width: 164rpx;
    font-size: 32rpx;
    font-weight: 500;
    color: #34404a;
  }

  .rmb {
    font-size: 30rpx;
    font-weight: 400;
    color: #34404a;
  }
}
.infos {
  padding: 0 32rpx;
  .clist {
    padding-left: 0;
    padding-right: 0;
  }
  .txt {
    height: 320rpx;
    background: #f8f9fc;
    border-radius: 16rpx;
    border: 2rpx solid rgba(0, 0, 0, 0.09);
    padding: 22rpx 20rpx;
    box-sizing: border-box;
    width: 100%;
  }
}
.h16 {
  height: 16rpx;
  background-color: #f5f7f9;
}
</style>
